* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Microsoft YaHei', Arial, sans-serif;
    background-color: #f5f5f5;
    color: #333;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

.search-header {
    text-align: center;
    margin-bottom: 40px;
    background: white;
    padding: 30px;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    position: relative;
}

.search-header h1 {
    color: #2c3e50;
    margin-bottom: 20px;
}

.search-form {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin-bottom: 20px;
    position: relative;
}

.search-input-wrapper {
    position: relative;
    width: 400px;
}

.search-input {
    width: 100%;
    padding: 12px 20px;
    border: 2px solid #ddd;
    border-radius: 25px;
    font-size: 16px;
    outline: none;
    transition: border-color 0.3s;
    autocomplete: off; /* 禁用浏览器自动补全 */
}

.search-input:focus {
    border-color: #3498db;
}

/* 搜索建议下拉框 */
.search-suggestions {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: white;
    border: 1px solid #ddd;
    border-top: none;
    border-radius: 0 0 10px 10px;
    box-shadow: 0 4px 10px rgba(0,0,0,0.1);
    z-index: 1000;
    max-height: 300px;
    overflow-y: auto;
    display: none;
}

.search-suggestions.show {
    display: block;
}

.suggestion-item {
    padding: 12px 20px;
    cursor: pointer;
    border-bottom: 1px solid #f0f0f0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: background-color 0.2s;
}

/* 在现有的 .suggestion-item 后添加 */
.suggestion-item.active {
    background-color: #f0f7ff;
}

.suggestion-item:hover {
    background-color: #f8f9fa;
}

.suggestion-item:last-child {
    border-bottom: none;
}

.suggestion-text {
    flex: 1;
    text-align: left;
}

.suggestion-type {
    font-size: 12px;
    color: #999;
    background: #ecf0f1;
    padding: 2px 8px;
    border-radius: 10px;
    margin-left: 10px;
}

.suggestion-remove {
    color: #999;
    cursor: pointer;
    padding: 2px 6px;
    border-radius: 3px;
    margin-left: 10px;
    opacity: 0;
    transition: opacity 0.2s;
}

.suggestion-item:hover .suggestion-remove {
    opacity: 1;
}

.suggestion-remove:hover {
    color: #e74c3c;
    background: #f8f9fa;
}

.search-btn {
    padding: 12px 30px;
    background: #3498db;
    color: white;
    border: none;
    border-radius: 25px;
    font-size: 16px;
    cursor: pointer;
    transition: background-color 0.3s;
}

.search-btn:hover {
    background: #2980b9;
}

.search-tabs {
    display: flex;
    justify-content: center;
    gap: 20px;
}

.tab-btn {
    padding: 8px 20px;
    border: 1px solid #ddd;
    background: white;
    border-radius: 20px;
    cursor: pointer;
    transition: all 0.3s;
    text-decoration: none;
    color: #666;
}

.tab-btn.active {
    background: #3498db;
    color: white;
    border-color: #3498db;
}

.tab-btn:hover {
    background: #ecf0f1;
}

.tab-btn.active:hover {
    background: #3498db;
}

/* 搜索历史面板 */
.search-history-panel {
    margin-top: 20px;
    padding: 20px;
    background: #f8f9fa;
    border-radius: 10px;
    text-align: left;
}

.search-history-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.search-history-title {
    font-size: 14px;
    color: #666;
    font-weight: 500;
}

.clear-history-btn {
    font-size: 12px;
    color: #999;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 4px;
    transition: all 0.2s;
}

.clear-history-btn:hover {
    color: #e74c3c;
    background: white;
}

.search-history-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.history-tag {
    padding: 6px 12px;
    background: white;
    border: 1px solid #ddd;
    border-radius: 15px;
    font-size: 13px;
    color: #666;
    cursor: pointer;
    transition: all 0.2s;
    position: relative;
    display: flex;
    align-items: center;
    gap: 6px;
}

.history-tag:hover {
    background: #3498db;
    color: white;
    border-color: #3498db;
}

.history-tag .remove-tag {
    color: #999;
    font-size: 12px;
    cursor: pointer;
    padding: 2px;
    border-radius: 50%;
    opacity: 0;
    transition: opacity 0.2s;
}

.history-tag:hover .remove-tag {
    opacity: 1;
    color: white;
}

.history-tag .remove-tag:hover {
    background: rgba(255,255,255,0.2);
}

.search-results {
    margin-top: 30px;
}

.results-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding: 15px 20px;
    background: white;
    border-radius: 10px;
    box-shadow: 0 1px 5px rgba(0,0,0,0.05);
}

.results-count {
    color: #666;
    font-size: 14px;
}

.sort-options select {
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 5px;
    background: white;
    color: #666;
}

.results-list {
    display: grid;
    gap: 20px;
    margin-bottom: 30px;
}

.result-item {
    background: white;
    padding: 25px;
    border-radius: 10px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
    transition: transform 0.2s, box-shadow 0.2s;
}

.result-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(0,0,0,0.15);
}

.result-type {
    display: inline-block;
    padding: 4px 12px;
    background: #ecf0f1;
    color: #7f8c8d;
    border-radius: 15px;
    font-size: 12px;
    margin-bottom: 15px;
    font-weight: 500;
}

.result-type.content {
    background: #e8f5e8;
    color: #27ae60;
}

.result-type.user {
    background: #e8f4fd;
    color: #3498db;
}

.result-title {
    font-size: 18px;
    font-weight: bold;
    color: #2c3e50;
    margin-bottom: 12px;
    cursor: pointer;
    transition: color 0.3s;
}

.result-title:hover {
    color: #3498db;
}

.result-description {
    color: #666;
    line-height: 1.6;
    margin-bottom: 15px;
    font-size: 14px;
}

.result-meta {
    display: flex;
    gap: 15px;
    font-size: 12px;
    color: #999;
    flex-wrap: wrap;
}

.user-result {
    display: flex;
    align-items: flex-start;
    gap: 15px;
}

.user-avatar {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: linear-gradient(135deg, #3498db, #2980b9);
    flex-shrink: 0;
    margin-top: 5px;
}

.user-info {
    flex: 1;
}

.user-info h3 {
    color: #2c3e50;
    margin-bottom: 8px;
    cursor: pointer;
    transition: color 0.3s;
    font-size: 16px;
}

.user-info h3:hover {
    color: #3498db;
}

.user-info p {
    color: #666;
    font-size: 14px;
    margin-bottom: 10px;
    line-height: 1.5;
}

.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
    margin-top: 40px;
    background: white;
    padding: 25px;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.page-btn {
    padding: 10px 16px;
    border: 1px solid #ddd;
    background: white;
    color: #666;
    text-decoration: none;
    border-radius: 6px;
    transition: all 0.3s;
    min-width: 44px;
    text-align: center;
    font-size: 14px;
}

.page-btn:hover {
    background: #3498db;
    color: white;
    border-color: #3498db;
    transform: translateY(-1px);
}

.page-btn.disabled {
    background: #f8f9fa;
    color: #ccc;
    cursor: not-allowed;
    border-color: #eee;
}

.page-btn.disabled:hover {
    background: #f8f9fa;
    color: #ccc;
    border-color: #eee;
    transform: none;
}

.page-info {
    color: #666;
    font-size: 14px;
    margin: 0 15px;
    padding: 0 10px;
}

.no-results {
    text-align: center;
    padding: 60px 20px;
    background: white;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    color: #666;
}

.no-results-icon {
    font-size: 48px;
    margin-bottom: 20px;
    color: #ddd;
}

.no-search-prompt {
    text-align: center;
    padding: 60px 20px;
    background: white;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    color: #666;
    margin-top: 30px;
}

.no-search-icon {
    font-size: 48px;
    margin-bottom: 20px;
    color: #ddd;
}

@media (max-width: 768px) {
    .search-input-wrapper {
        width: 300px;
    }

    .search-form {
        flex-direction: column;
        align-items: center;
    }

    .results-header {
        flex-direction: column;
        gap: 15px;
        text-align: center;
    }

    .user-result {
        flex-direction: column;
        text-align: center;
    }

    .pagination {
        flex-wrap: wrap;
        padding: 20px;
    }

    .search-history-tags {
        justify-content: center;
    }
}

.sort-options select {
    padding: 12px 40px 12px 20px; /* 增加垂直内边距 */
    border: 2px solid #ddd; /* 加粗边框 */
    border-radius: 25px; /* 圆角与输入框一致 */
    background: white;
    color: #666;
    font-size: 16px; /* 字体大小与输入框一致 */
    height: 100%; /* 高度与其他元素一致 */
    -webkit-appearance: none; /* 移除默认样式 */
    -moz-appearance: none;
    appearance: none;
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23333' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 15px center;
    background-size: 16px;
    cursor: pointer;
    min-width: 120px; /* 设置最小宽度 */
}
.sort-options select:hover,
.sort-options select:focus {
    border-color: #3498db; /* 悬停/聚焦时边框变蓝 */
    outline: none; /* 移除默认轮廓 */
}
.sort-options {
    position: relative;
    height: 48px; /* 固定高度与其他元素匹配 */
    display: flex;
    align-items: center;
}
@media (max-width: 768px) {
    .sort-options {
        width: 100%;
        max-width: 300px;
    }

    .sort-options select {
        width: 100%;
    }
}
/* AI解释区域样式 */
.ai-explanation-section {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 15px;
    padding: 1px;
    box-shadow: 0 4px 20px rgba(102, 126, 234, 0.3);
}

.ai-explanation-container {
    background: white;
    border-radius: 14px;
    padding: 25px;
    position: relative;
}

.ai-explanation-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 18px;
    padding-bottom: 15px;
    border-bottom: 2px solid #f0f7ff;
}

.ai-icon {
    font-size: 28px;
    animation: bounce 2s infinite;
}

@keyframes bounce {
    0%, 20%, 50%, 80%, 100% {
        transform: translateY(0);
    }
    40% {
        transform: translateY(-5px);
    }
    60% {
        transform: translateY(-3px);
    }
}

.ai-explanation-header h3 {
    color: #2c3e50;
    margin: 0;
    font-size: 18px;
    font-weight: 600;
    flex: 1;
}

.ai-status {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    color: #7f8c8d;
}

.loading-spinner {
    animation: spin 1s linear infinite;
}

@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

.ai-explanation-content {
    min-height: 60px;
}

.ai-explanation-text {
    background: #f8fbff;
    padding: 20px;
    border-radius: 10px;
    border-left: 4px solid #3498db;
    font-size: 15px;
    line-height: 1.7;
    color: #2c3e50;
}

.ai-explanation-text p {
    margin: 0;
}

.ai-explanation-error {
    background: #fff5f5;
    padding: 15px 20px;
    border-radius: 10px;
    border-left: 4px solid #e74c3c;
    color: #666;
    font-size: 14px;
}

.ai-explanation-error p {
    margin: 0;
}

.ai-explanation-loading {
    text-align: center;
    padding: 30px 20px;
    color: #7f8c8d;
}

.loading-animation {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin-bottom: 15px;
}

.loading-dot {
    width: 8px;
    height: 8px;
    background: #3498db;
    border-radius: 50%;
    animation: wave 1.4s ease-in-out infinite both;
}

.loading-dot:nth-child(2) {
    animation-delay: -1.32s;
}

.loading-dot:nth-child(3) {
    animation-delay: -1.16s;
}

@keyframes wave {
    0%, 80%, 100% {
        transform: scale(0.5);
        opacity: 0.5;
    }
    40% {
        transform: scale(1);
        opacity: 1;
    }
}

/* 响应式设计 */
@media (max-width: 768px) {
    .ai-explanation-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }

    .ai-explanation-container {
        padding: 20px 15px;
    }
}